package com.java.singleton;

/**
 * @author Lenl
 * @create 2021-05-30 23:18
 * 单例模式懒汉式实现
 */
public class SingtonTest2 {
}

class Order{
    //1.私有化类的构造器
    private Order(){

    }
    //2.声明当前类对象，没有初始化
    private static Order instance =null;
    //3.声明public static的方法返回当前类对象
    public static Order getInstance(){
        if(instance==null){
            instance=new Order();
        }
        return  instance;
    }
}